package top.lingkang.fas.admin.web.impl;

/**
 * 验证码对象，包含问题和答案
 *
 * @author lingkang
 * created by 2025/7/20 2:30
 */
public class Captcha {
    private final String question;
    private final int answer;

    public Captcha(String question, int answer) {
        this.question = question;
        this.answer = answer;
    }

    public String getQuestion() {
        return question;
    }

    public int getAnswer() {
        return answer;
    }

    /**
     * 验证用户输入的答案是否正确
     *
     * @param userAnswer 用户输入的答案
     * @return 答案是否正确
     */
    public boolean validate(int userAnswer) {
        return this.answer == userAnswer;
    }
}
